import React,{ useContext } from 'react';
import { CHANGE_COLOR,ColorContext } from './color'

function Btn(){
    const { dispatch } = useContext(ColorContext)
    return (<>
        <button onClick={()=>{dispatch({color:"green",type:CHANGE_COLOR})}}>绿色</button>
        <button onClick={()=>{dispatch({color:"red",type:CHANGE_COLOR})}}>红色</button>
    </>)
}

export default Btn